import Vue from 'vue'
import VueRouter from 'vue-router';
Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err) //解决在使用ElementUI中的导航时，默认情况下如果重复点击某选项，会报错。
  //vueRouter:Avoided redundant navigation to current location
}


const Home = () => import('@/pages/Home.vue')
const Good = () => import('@/pages/Good.vue')
const Find = () => import('@/pages/Find.vue')
const Filter =() => import('@/pages/Filter.vue')
const Login = () =>import('./pages/Login.vue')
const Resigt = () =>import('./pages/Resigt.vue')
const Quill = () =>import('./pages/Quill.vue')
const Add = () =>import('./pages/Add.vue')


let router = new VueRouter({
    routes:[
        {path:'/home',component:Home},
        {path:'/good',component:Good},
        {path:'/find',component:Find},
        {path:'/filter',component:Filter},
        {path:'/login',component:Login},
        {path:'/resigt',component:Resigt},
        {path:'/quill',component:Quill},
        {path:'/add',component:Add},
        {path:'/',redirect:'/home'},
    ]   
    
})

export default router